package com.herong.framework.factory;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.core.io.Resource;

public class SpringUtil {
	static final String APP_FILE = "applicationContext.xml";
	static InputStream in = null;

	
	public static Object getBean(String beanName) throws FileNotFoundException{
		
		ClassPathXmlApplicationContext app = new ClassPathXmlApplicationContext(
				new String[]{APP_FILE});
		
		return app.getBean(beanName);
	}
	
	public static void main(String[] args) throws FileNotFoundException{
		System.out.println(SpringUtil.getBean("commDAO"));
	}
}
